﻿using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using Newtonsoft.Json;

namespace ThresholdAssistant.DataContract.Param
{
    /// <summary>
    /// 机器人指令消息内容
    /// </summary>
    [Serializable]
    public class PublishCmdMessageBody : CmdMessageBody
    {
        /// <summary>
        /// 命令编码
        /// </summary>
        [JsonProperty("cmd"), JsonPropertyName("cmd")]
        public new int Cmd { get; set; }

        /// <summary>
        /// 时间戳(13位,毫秒)
        /// </summary>
        [JsonProperty("time_stamp"), JsonPropertyName("time_stamp")]
        public long TimeStamp { get; set; }
    }

    /// <summary>
    /// 机器人指令消息内容
    /// </summary>
    /// <typeparam name="T"></typeparam>
    [Serializable]
    public class PublishCmdMessageBody<T> : PublishCmdMessageBody where T : class
    {
        /// <summary>
        /// 指令Json参数
        /// </summary>
        [JsonProperty("data"), JsonPropertyName("data")]
        public T Data { get; set; }
    }
}